package model

import (
	"broker/interface/imodel"
	messageID "broker/struct/common/message_id"
)

/**
 * @Description
 * @Author huan.wang
 * @Date 2021/4/30 11:08 上午
 **/

type UnSubscribeMessage struct {
	*BaseMessage
	PacketID     uint16
	TopicFilters []imodel.ITopicFilter
}

func NewUnSubscribeMessage() *UnSubscribeMessage {
	return &UnSubscribeMessage{
		NewMsgIDBaseMessage(messageID.UnSubscribe),
		0,
		make([]imodel.ITopicFilter, 0),
	}
}

func (sm *UnSubscribeMessage) AddTopicFilter(filter imodel.ITopicFilter) {
	sm.TopicFilters = append(sm.TopicFilters, filter)
}
